package cn.daniellee.plugin.ice.command;

import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public class BaoxueCompleter implements TabCompleter {

	private String[] subCommands = {"toggle", "period", "suction", "violent", "reload"};
	private String[] seconds = {"10", "30", "60", "120"};
	private String[] suctions = {"s", "m", "l", "v"};

	@Override
	public List<String> onTabComplete(CommandSender commandSender, Command command, String s, String[] strings) {
		if (strings.length == 0) return Arrays.asList(subCommands);
		else if (strings.length == 1) return Arrays.stream(subCommands).filter(string -> string.startsWith(strings[0])).collect(Collectors.toList());
		else if (strings.length == 2) {
			if ("period".equals(strings[0])) return Arrays.asList(seconds);
			else if ("suction".equals(strings[0])) return Arrays.asList(suctions);
		}
		return new ArrayList<>();
	}

}
